package com.mls.fivedistrict.server.impl;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.mls.fivedistrict.dao.VoteOptionMapper;
import com.mls.fivedistrict.pojo.VoteOption;
import com.mls.fivedistrict.server.VoteOptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 投票选项 服务实现类
 * </p>
 *
 * @author Five Team
 * @since 2018-05-15
 */
@Service
public class VoteOptionServiceImpl extends ServiceImpl<VoteOptionMapper, VoteOption> implements VoteOptionService {
    @Autowired
    private VoteOptionMapper voteOptionMapper;

//    @Override
//    public List<VoteOption> selectListAndVoteOption() {
//        PageHelper.startPage(pageFilter.getPageNum(), pageFilter.getPageSize());
//        List<VoteOption> voteOptionList = voteOptionMapper.selectListAndVote();
//        return voteOptionList;
//    }


    @Override
    public VoteOption selectAndVoteById(Long voteOptionId) {
        VoteOption voteOption = voteOptionMapper.selectAndVote(voteOptionId);
        return voteOption;
    }

    @Override
    public List<VoteOption> selectListAndVoteOption(Wrapper wrapper) {
        List<VoteOption> voteOptionList = voteOptionMapper.selectListAndVote(wrapper);
        return voteOptionList;
    }

    @Override
    public int addJoinCount(Long voteOptionId) {
        int row = voteOptionMapper.addJoinCount(voteOptionId);
        return row;
    }
}
